if [ "$PATCH_LVL" = "X11/NeWS Server - Patch #3000-114" ]; then
echo "Patch has already been applied to your system. No need to continue"
exit 0
fi
# Lets search for the IDL directory
for DIR in $1 . $IDL_DIR/bin.sunos.4.1 /usr/local/lib/idl/bin.sunos.4.1 /usr/local/idl/bin.sunos.4.1 ./bin.sunos.4.1 ../bin.sunos.4.1 $IDL_DIR/bin/bin.sunos.4.1 /usr/local/rsi/idl/bin/bin.sunos.4.1 /usr/local/idl/bin/bin.sunos.4.1 ./bin/bin.sunos.4.1 ../bin/bin.sunos.4.1
do
if [ -d $DIR ]; then
if [ \( -f $DIR/xnews.Z \) -o \( -f $DIR/xnews \) ]; then
SRC_DIR=$DIR
break
fi
fi
done
# Does the source directory exist?
if [ "$SRC_DIR" = "" ]; then
echo "Unable to find the source directory for the patch file."
echo "To specify the source directory at the command line, issue the "
echo "following command:"
echo " % "$PROG_NAME " <source directory>"
exit 1
fi
# Do the "are you sure?" prompt.
echo ""
echo "The following has been detected:"
echo " Source directory of the patch: "$SRC_DIR
echo " Destination directory for the patch: "$DST_DIR
echo ""
echo -n "Are you sure you want to apply the patch? Enter y to do so: "
read ANSWER
if [ \( "$ANSWER" != "y" \) -a \( "$ANSWER" != "Y" \) ]; then
echo "Aborting patch."
exit 1
fi
# Can we access the dst file
if [ \( ! -r $DST_DIR/xnews \) -o \( ! -w $DST_DIR/xnews \) ]; then
echo ""
echo "Unable to read and/or write to the file $DST_DIR/xnews"
echo "Aborting."
exit 1
fi
# if the replacement file is compressed, uncompress it
if [ -f $SRC_DIR/xnews.Z ]; then
uncompress $SRC_DIR/xnews.Z
fi
# Rename the current file that contains xnews
mv $DST_DIR/xnews $DST_DIR/$OLD_FILE
if [ "$?" != "0" ]; then
echo "Error in renaming" $DST_DIR"/xnews to" $DST_DIR"/"$OLD_FILE